<?

/*	Social.addthis OBJECT
*	Comment here
*
*					*/


class SocialAddthis extends MOD {


	function output () {
		
		if( $this->action )
			$result = $this->{ "filter_" . $this->action }();

		return $this->parse( $result );
		
	}
	
/*	PARSE FUNCTIONALITIES
*	parse_meta builds the flashVars attribute, 
*	based on a variable json_object
*
*	parse_external builds the external source string
*					*/
	function filter_default () {
		
		$IMG = new MEDIA( array( "img"=>"addthis.blank.png" ));
		
		$body = "<script type='text/javascript'>var addthis_pub = 'koenbetsens';</script>
		<a href='http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly' onmouseover=\"return addthis_open(this, '', 'http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."');\" onmouseout=\"addthis_close();\" onclick=\"return addthis_sendto();\">
			" . $IMG->_img() . "</a>
		<script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly'></script>";
		
		return $body;
	}
	
	
	/**
	 *	sharecount (http://www.addthis.com/web-button-select)
	 *	share buttons with counters
	 * 	@param		array (type is pill_style / 
	 *	@return		string
	 */
	function filter_sharecount() {
	
		$type = (( $this->vars->type ) ? $this->vars->type : 'pill_style' );
	
		switch( $type ) {
	
			case 'pill_style':	
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
				<a class="addthis_button_tweet"></a>
				<a class="addthis_counter addthis_pill_style"></a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			default:
			
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a class="addthis_counter addthis_pill_style"></a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
		}
			
		return $body;
	}
	
	
	/**
	 *	toolbox (http://www.addthis.com/web-button-select)
	 *	share buttons with a toolbox
	 * 	@param		array (type is pill_style / 
	 *	@return		string
	 */
	function filter_toolbox() {
	
		$type = (( $this->vars->type ) ? $this->vars->type : '' );
	
		switch( $type ) {
	
			case 'icons':	
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a class="addthis_button_facebook" style="cursor:pointer"></a>
				<a class="addthis_button_twitter" style="cursor:pointer"></a>
				<a class="addthis_button_email" style="cursor:pointer"></a>
				<a class="addthis_button_compact"></a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			case 'simple':	
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly" class="addthis_button_compact">Share</a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			case 'fb_twitter':
				$body = '<div class="addthis_toolbox addthis_default_style">
        		<a class="addthis_button_tweet" tw:count="horizontal"></a>
    		    <a class="addthis_button_facebook_like"></a>
    			</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			case 'mailer':
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a class="addthis_button_email"></a>
				<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly" class="addthis_button_compact"></a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			default:
			
				$body = '<div class="addthis_toolbox addthis_default_style ">
				<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly" class="addthis_button_compact">Share</a>
				<span class="addthis_separator">|</span>
				<a class="addthis_button_preferred_1"></a>
				<a class="addthis_button_preferred_2"></a>
				<a class="addthis_button_preferred_3"></a>
				<a class="addthis_button_preferred_4"></a>
				</div>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
		}
			
		return $body;
	}


	/**
	 *	toolbox (http://www.addthis.com/web-button-select)
	 *	share buttons with a toolbox
	 * 	@param		array (type is pill_style / 
	 *	@return		string
	 */
	function filter_button() {
	
		$type = (( $this->vars->type ) ? $this->vars->type : 'small' );
	
		switch( $type ) {
	
			case 'large':	
				$body = '<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" 
				height="16" alt="Bookmark and Share" style="border:0"/></a>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
			default:
			
				$body = '<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=onedotonly"><img src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" 
				height="16" alt="Bookmark and Share" style="border:0"/></a>
				<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=onedotonly"></script>';
				break;
				
		}
			
		return $body;
	}
	
} 

?>